package calendar;

import java.util.Date;

/**
 * Klasse repräsentiert einen Termin
 * 
 * @author Michi
 * 
 */
public class Event {

	private int eventID;
	private int calID;
	private String name;
	private Date start;
	private Date end;
	private String ort;
	private String description;

	public int getEventID() {
		return eventID;
	}

	public int getCalID() {
		return calID;
	}

	public String getName() {
		return name;
	}

	public Date getStart() {
		return start;
	}

	public Date getEnd() {
		return end;
	}

	public String getOrt() {
		return ort;
	}

	public String getDescription() {
		return description;
	}

	public void setEventID(int eventID) {
		this.eventID = eventID;
	}

	public void setCalID(int calID) {
		this.calID = calID;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setStart(Date start) {
		this.start = start;
	}

	public void setEnd(Date end) {
		this.end = end;
	}

	public void setOrt(String ort) {
		this.ort = ort;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * Konstruktor
	 * 
	 * @param eventID
	 *            ID des Termins
	 * @param calID
	 *            Kalender ID des Termins
	 * @param name
	 *            Name des Termins
	 * @param start
	 *            Beginn des Termins
	 * @param end
	 *            Ende des Termins
	 * @param ort
	 *            Ort des Termins
	 * @param description
	 *            Beschreibung des Termins
	 */
	public Event(int eventID, int calID, String name, Date start, Date end,
			String ort, String description) {
		super();
		this.eventID = eventID;
		this.calID = calID;
		this.name = name;
		this.start = start;
		this.end = end;
		this.ort = ort;
		this.description = description;
	}

	/**
	 * to String - gibt Textuelle repräsentatiin des Termins aus
	 */
	@SuppressWarnings("deprecation")
	public String toString() {
		String str = "";
		String startHours = "";
		String startMinutes = "";
		String endHours = "";
		String endMinutes = "";

		startHours = getStart().getHours() + "";

		if (getStart().getMinutes() < 10) {
			startMinutes = "0" + getStart().getMinutes();
		} else {
			startMinutes = getStart().getMinutes() + "";
		}

		endHours = getEnd().getHours() + "";

		if (getEnd().getMinutes() < 10) {
			endMinutes = "0" + getEnd().getMinutes();
		} else {
			endMinutes = getEnd().getMinutes() + "";
		}

		str = "<html>" + name + "<br />" + startHours + ":" + startMinutes
				+ " - " + endHours + ":" + endMinutes + "<br />" + "</html>";

		if (ort != "") {
			str = "<html>" + name + "<br />" + startHours + ":" + startMinutes
					+ " - " + endHours + ":" + endMinutes + "<br />" + ort
					+ "</html>";

		}

		return str;
	}
}
